<template>
  <keep-alive>
    <component v-bind:is="currentComponent" v-bind="curProps" :ref="curComponentName"></component>
  </keep-alive>
</template>


<script>

import TurnDown from './TurnDown';
import ShellAssets from './ShellAssets';
export default {
  
  name:'ParentTurnDownFactory',
  props: {
    menuCode: String,
  },
  data () {
    return {
        currentComponent:ShellAssets,
        curProps:{menuCode:this.menuCode},
        curComponentName:'TurnDown'
    }
  },
  methods:{
    setCurrentComponent:function(type,data){
      if(type=="TurnDown")
      {
         this.curProps = data;
         this.currentComponent = TurnDown;
         this.curComponentName = 'TurnDown'
      }
      else if(type=="goBack"){
        this.currentComponent = ShellAssets;
        this.curComponentName = 'ShellAssets'
      }
    },
    enterDown(){
      if(this.$refs[this.curComponentName]&&this.$refs[this.curComponentName].enterDown){
        this.$refs[this.curComponentName].enterDown()
      }
    }
  },
  mounted: function mounted() {
    //this.$router.push({ path: '/ShellAssets' });//跳转到该路由
  }
}


</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>

</style>
